package com.ep.xml;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

public class MainActivity extends AppCompatActivity {
    private static final String TAG = "MainActivity";
    private String xmlString="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
            "<root><msgname>user/queryUserInfo</msgname><transactionid>1241241</transactionid>" +
            "<timestamp></timestamp><result>000000</result><resultdesc>请求成功</resultdesc>" +
            "<body><name>vitor</name><identitycardno>1234568797994564</identitycardno>" +
            "<photo>adfsadfads</photo><birthdate>1990-12-26</birthdate><validdate>456</validdate><address>深圳</address><signorg>opsdf</signorg><nation>汉</nation>" +
            "<sex></sex><mobile>15019297974</mobile><email>wuzq@qq.com</email><accountno>00118881000030200009</accountno>" +
            "<isrealname>0</isrealname><username>wuzq</username><retcode>000000</retcode><retmsg></retmsg></body></root>";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void xmlToBean(View view){
        UserInfo userInfo=XmlUtil.xmlToObject(xmlString,UserInfo.class,"body");
        Log.d(TAG,"userInfo---------->"+userInfo.toString());

    }

    public void beanToXml(View view){

    }
}
